<?xml version="1.0" encoding="utf-8" ?>
<xs:schema
    targetNamespace="urn:deployment-exportsettings-schema"
    elementFormDefault="qualified"
    xmlns="urn:deployment-exportsettings-schema"
    xmlns:mstns="urn:deployment-exportsettings-schema"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <!-- Guid SimpleType definition -->
    <xs:simpleType name="Guid">
        <xs:restriction base="xs:string"></xs:restriction>
    </xs:simpleType>

    <!-- Used for SPExportObjects -->
    <xs:simpleType name="SPDeploymentObjectType">
        <xs:restriction base="xs:string">
           <xs:enumeration value="Site" />
           <xs:enumeration value="Web" />                          
           <xs:enumeration value="Folder" />
           <xs:enumeration value="List" /> 
           <xs:enumeration value="ListItem" />
           <xs:enumeration value="File" />
        </xs:restriction>
    </xs:simpleType>

    <!-- Used for SPExportObjects -->
    <xs:simpleType name="SPIncludeDescendants">
        <xs:restriction base="xs:string">
            <xs:enumeration value="None" />
            <xs:enumeration value="Content" />
            <xs:enumeration value="All" />
        </xs:restriction>
    </xs:simpleType>

    <!-- From SPDeploymentSettings -->
    <xs:simpleType name="SPIncludeSecurity">
        <xs:restriction base="xs:string">
            <xs:enumeration value="None" />
            <xs:enumeration value="WssOnly" />
            <xs:enumeration value="All" />
        </xs:restriction>
    </xs:simpleType>

    <!-- From SPExportSettings -->
    <xs:simpleType name="SPIncludeVersions">
        <xs:restriction base="xs:string">
            <xs:enumeration value="LastMajor" />
            <xs:enumeration value="CurrentVersion" />
            <xs:enumeration value="LastMajorAndMinor" />
            <xs:enumeration value="All" />
        </xs:restriction>
    </xs:simpleType>

    <!-- From SPExportSettings -->
    <xs:simpleType name="SPExportMethodType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="ExportAll" />
            <xs:enumeration value="ExportChanges" />
        </xs:restriction>
    </xs:simpleType>

    <!-- This defines that the XML can contain 0-N instances of the -->
    <!-- SPExportObjects element -->
    <xs:complexType name="SPExportSettings">
        <xs:sequence>
            <xs:element
                name="ExportObjects" type="SPExportObjectCollection"
                minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>

        <!-- SPDeploymentSettings -->
        <xs:attribute name="SiteUrl" type="xs:string" />
        <xs:attribute name="FileLocation" type="xs:string" />
        <xs:attribute name="BaseFileName" type="xs:string" />
        <xs:attribute name="IncludeSecurity" type="SPIncludeSecurity" />

        <!-- SPExportSettings -->
        <xs:attribute name="IncludeVersions" type="SPIncludeVersions" />
        <xs:attribute name="ExportMethod" type="SPExportMethodType" />
        <xs:attribute name="ExportChangeToken" type="xs:string" />
        <xs:attribute name="ExportPublicSchema" type="xs:boolean" default="true" />
        <xs:attribute name="ExportFrontEndFileStreams" type="xs:boolean" default="true" />
        <xs:attribute name="ExcludeDependencies" type="xs:boolean" />
    </xs:complexType>

    <xs:complexType name="SPExportObjectCollection">
        <xs:sequence>
            <xs:element
                 name="DeploymentObject" type="SPExportObject"
                 minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="SPExportObject"><!-- : SPDeploymentObject -->
        <!-- SPDeploymentObject -->
        <xs:attribute name="Id" type="Guid" />
        <xs:attribute name="Type" type="SPDeploymentObjectType" />
        <xs:attribute name="ParentId" type="Guid" />

        <!-- SPExportObject -->
        <xs:attribute name="Url" type="xs:string" />
        <xs:attribute name="ExcludeChildren" type="xs:boolean" />
        <xs:attribute name="IncludeDescendants" type="SPIncludeDescendants" />
        <xs:attribute name="ExportChangeToken" type="xs:string" />
    </xs:complexType>

    <!-- This defines that the XML can contain 0-N instances of the -->
    <!-- ExportSettings element -->
    <xs:element name="ExportSettings" type="SPExportSettings" />
</xs:schema>
